var myModule = angular.module("myModule",[]);

myModule.controller("myCtrl",['$scope',function ($scope) {
    $scope.loadData=function () {
        console.log("加载数据中...");
    }
}]);

myModule.directive("loader",function () {
    return{
        restrict:"AE",
        link:function (scope,element,attrs) {
            element.bind("mouseenter",function () {
                //scope.loadData();
                //scope.$apply("loadData()");
                // 注意这里的坑，howToLoad会被转换成小写的howtoload
                scope.$apply(attrs.howtoload);
            });
        }
    }
});

myModule.controller("myCtrl2",['$scope',function ($scope) {
    $scope.loadData2=function () {
        console.log("加载数据中22222...");
    }
}]);